﻿using B.S.Sterilizationcenter.Domain.zyy;
using B.S.Sterilizationcenter.ErrorCode;
using B.S.Sterilizationcenter.Read.API.Application.Command.UsageManagements;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Sterilizationcenter.Read.API.Controllers.ZYY.UsageManagements
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class UsageController : ControllerBase
    {
        private readonly IMediator med;

        public UsageController(IMediator med)
        {
            this.med = med;
        }
        /// <summary>
        /// 显示使用管理
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<UsageManagement>>> GetUsage([FromQuery] Usagecommand request, CancellationToken cancellationToken)
        {
            return med.Send(request, cancellationToken);
        }
        /// <summary>
        /// 反填使用管理
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<UsageManagement>>> FanUsage([FromQuery] FanUsagecommand request, CancellationToken cancellationToken)
        {
            return med.Send(request, cancellationToken);
        }
    }
}
